package logik;

import data.BankDatabase;

public class AuthenticateUser {

	private boolean userAuthenticated;
	private BankDatabase bankDatabase;
	private int currentAccountNumber;
	private int currentPin = 0;
	private int accountNumber = 0;
	
	public AuthenticateUser(){
		this.userAuthenticated = false;
		this.currentPin = 0;
		this.accountNumber = 0;
	}
	
	public void authenticateUser(){
		currentAccountNumber =
		
		userAuthenticated =
				bankDatabase.authenticateUser(currentAccountNumber, currentPin );
		// check whether authentication succeeded
		if (userAuthenticated) {
			currentAccountNumber = accountNumber; // save user's account
		} // end if		
		else {
			System.out.println("Invalid account number or PIN. Please try again.");
		} // end else
	} // end method authenticateUser
}
